package com.ruoyi.politicalstatus.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.politicalstatus.domain.ExamPoliticalStatus;
import com.ruoyi.politicalstatus.service.IExamPoliticalStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "基础管理-政治面貌")
@RestController
@RequestMapping("/politicalstatus")
public class ExamPoliticalStatusController {

    @Autowired
    private IExamPoliticalStatusService politicalStatusService;

    /**
     * 查询政治面貌列表
     */
                @ApiOperation("政治面貌管理 - 分页查询列表")
    @GetMapping("/list")
    public AjaxResult list() {
        List<ExamPoliticalStatus> list = politicalStatusService.selectPoliticalStatusList();
        return AjaxResult.success(list);
    }

    /**
     * 根据ID获取政治面貌详情
     */
                @ApiOperation("政治面貌管理 - 根据ID获取详细信息")
    @GetMapping("/info")
    public AjaxResult getInfo(@RequestParam Long id) {
        return AjaxResult.success(politicalStatusService.selectPoliticalStatusById(id));
    }

    /**
     * 新增政治面貌
     */
                @ApiOperation("政治面貌管理 - 新增数据")
    @PostMapping
    public AjaxResult add(@RequestBody ExamPoliticalStatus politicalStatus) {
        return AjaxResult.success(politicalStatusService.insertPoliticalStatus(politicalStatus));
    }

    /**
     * 修改政治面貌
     */
                @ApiOperation("政治面貌管理 - 修改数据")
    @PutMapping
    public AjaxResult edit(@RequestBody ExamPoliticalStatus politicalStatus) {
        return AjaxResult.success(politicalStatusService.updatePoliticalStatus(politicalStatus));
    }

    /**
     * 删除政治面貌
     */
                @ApiOperation("政治面貌管理 - 删除数据")
    @DeleteMapping
    public AjaxResult remove(@RequestParam Long id) {
        return AjaxResult.success(politicalStatusService.deletePoliticalStatusById(id));
    }
}
